/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fiad.database.jpa;

import java.util.List;
import javax.persistence.Query;

/**
 *
 * @author MJ
 */
public class KurseDAO extends MyManager implements ILesen, ISchreiben, ILoeschen, IUpdate {
   private static KurseDAO instance = null;

    public static KurseDAO getInstance() {
        if(instance == null){
            instance = new KurseDAO();
        }
        return instance;
    }

    //Singleton
    private KurseDAO(){}


    public Object leseEinzel(long id) {
        return getEntityManager().createNamedQuery("lesenKurs").getSingleResult();
    }

    public List leseAlle() {
        Query query = getEntityManager().createNamedQuery("lesenALLEKurs");
        List resultList = query.getResultList();
        return resultList;

    }
}
